/**
 * 版权所有：厦门市巨龙信息科技有限公司
 * Copyright 2023 Xiamen Dragoninfo Eng. Co. Ltd.
 * All right reserved.
 */
package com.github.alfred.exception;


import com.github.alfred.enums.IErrorCodeEnum;

/**
 * 类说明
 *
 * @author chengh
 * @date 2023/5/22 21:40
 */
public class BizException extends BaseException {

    private static final long serialVersionUID = 1L;

    private static final String DEFAULT_ERR_CODE = "BIZ_ERROR";

    public BizException(IErrorCodeEnum errorCodeEnum) {
        super(errorCodeEnum.getErrorCode(),errorCodeEnum.getErrorMsg());
    }

    /**
     * 格式化输出
     * @param errorCodeEnum
     * @param args
     */
    public BizException(IErrorCodeEnum errorCodeEnum, Object... args) {
        super(errorCodeEnum.getErrorCode(), String.format(errorCodeEnum.getErrorMsg(), args));
    }

    public BizException(String errMessage) {
        super(DEFAULT_ERR_CODE, errMessage);
    }

    public BizException(String errCode, String errMessage) {
        super(errCode, errMessage);
    }

    public BizException(String errMessage, Throwable e) {
        super(DEFAULT_ERR_CODE, errMessage, e);
    }

    public BizException(String errorCode, String errMessage, Throwable e) {
        super(errorCode, errMessage, e);
    }

}
